<template>
	<view style="padding: 30rpx;box-sizing: border-box;background-color: #EDF1F2;min-height: 100vh;">
		<view class="box">
			<view class="topBox">
				<view class="zuo">
					<text style="border-left: 8upx solid #3291F8;padding: 0 15upx;">个人资料</text>
				</view>
				<view class="you" @click="portrait">
					<text style="font-weight: bold;letter-spacing: 10rpx;">+</text>编辑
				</view>
			</view>
			<view class="portraitt">
				<view class="" style="margin: 0 auto;width: 100%;text-align: center;">
					<image style="width: 120rpx;height: 120rpx;border-radius: 50%;display: block;margin: 20rpx auto;" :src="form.base.head_img" mode=""></image>
					<text style="color: #101010; font-size: 34rpx;">{{form.base.name}}</text>
				</view>
			</view>
		</view>
		<view class="box">
			<view class="topBox">
				<view class="zuo">
					<text style="border-left: 8upx solid #3291F8;padding: 0 15upx;">教育经历</text>
				</view>
				<view class="you" @click="education">
					<text style="font-weight: bold;letter-spacing: 10rpx;">+</text>添加
				</view>
			</view>
			<view class="portrait jy">
				<view class="zuo">
					<view v-if="form.edu==false"></view>
					<view v-else style="width: 30rpx;">
						<view class="" style="width: 15rpx;height: 15rpx;background-color: #3291F8;border-radius: 50%;margin: 0 auto;"></view>
					</view>
					<view class="zzi" v-for="(item,index) in form.edu" :key="index" @click="xg(item.id)">
						<view class="">
							<view class="zi">{{item.start_time}}-{{item.end_time}}</view>
							<view class="zi" style="margin-bottom: 15rpx;">{{item.school_name}} | {{item.edu_type_name}}</view>
							<view class="hui">主修专业：{{item.major}}</view>
						</view>
						<image class="da" src="../../static/blue_right.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
		
		<view class="box">
			<view class="topBox">
				<view class="zuo">
					<text style="border-left: 8upx solid #3291F8;padding: 0 15upx;">工作经历</text>
				</view>
				<view class="you" @click="work">
					<text style="font-weight: bold;letter-spacing: 10rpx;">+</text>添加
				</view>
			</view>
			<view class="portrait jy">
				<view class="zuo">
					<view v-if="form.exp==false"></view>
					<view v-else style="width: 30rpx;">
						<view class="" style="width: 15rpx;height: 15rpx;background-color: #3291F8;border-radius: 50%;margin: 0 auto;"></view>
					</view>
					<view class="zzi" v-for="(item,index) in form.exp" :key="index" @click="workxg(item.id)">
						<view class="">
							<view class="zi">{{item.start_time}}-{{item.end_time}}</view>
							<view class="zi">{{item.company_name}}</view>
							<view class="hui">{{item.position}}</view>
						</view>
						<image class="da" src="../../static/blue_right.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
		
		<view class="box">
			<view class="topBox">
				<view class="zuo">
					<text style="border-left: 8upx solid #3291F8;padding: 0 15upx;">技能/证书</text>
				</view>
				<view class="you" @click="skill">
					<text style="font-weight: bold;letter-spacing: 10rpx;">+</text>添加
				</view>
			</view>
			<view class="portrait gz">
				<view class="zuo" v-for="(item,index) in form.cer" :key="index" @click="skillxg(item.id)">
					<view style="margin-left: 25rpx;">
						<text>{{item.name}}</text>
						<text>{{item.des}}</text>
					</view>
					<image src="../../static/blue_right.png" style="width: 40upx; height: 40upx;"></image>
				</view>
			</view>
		</view>
		<view class="box">
			<view class="topBox">
				<view class="zuo">
					<text style="border-left: 8upx solid #3291F8;padding: 0 15upx;">自我评价</text>
				</view>
				<view class="you" @click="evaluate()">
					<text style="font-weight: bold;letter-spacing: 10rpx;">+</text>添加
				</view>
			</view>
			<view class="box pj" @click="evaluate()">
				<text v-if="form.base.evaluate">{{form.base.evaluate}}</text>
				<text v-else>
					<text style="font-weight: bold;">+</text>添加自我评价
				</text>
			</view>
		</view>
		<view class="box">
			<view class="topBox">
				<view class="zuo">
					<text style="border-left: 8upx solid #3291F8;padding: 0 15upx;">生活照</text>
				</view>
				<view class="you" @click="uploadPhotos">
					<text style="font-weight: bold;letter-spacing: 10rpx;">+</text>添加
				</view>
			</view>
			<view class="shz">
				<scroll-view scroll-x="true" class="bookshelf-content">
					<block>
						<image @tap="previewImg(index)" v-for="(item,index) in form.base.pic" :key="index" :src="item" mode="heightFix"></image>
					</block>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form:{
					base:{
						head_img:''
					}
				}
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.jl()
		},
		methods: {
			async jl(){
				const res = await this.post('/Index/User/get_preview_user_resume')
				this.form=res.data
				this.form.base.pic=this.form.base.pic.split(',')
			},
			previewImg(i){
				uni.previewImage({
					current: i,
					urls: this.form.base.pic
				})
			},
			uploadPhotos(){
				uni.navigateTo({
					url:'./uploadPhotos'
				})
			},
			evaluate(){
				uni.navigateTo({
					url:'./evaluate'
				})
			},
			skillxg(e){
				uni.navigateTo({
					url:'./skill?id='+e
				})
			},
			skill(){
				uni.navigateTo({
					url:'./skill'
				})
			},
			workxg(e){
				uni.navigateTo({
					url:'./work?id='+e
				})
			},
			xg(e){
				uni.navigateTo({
					url:'./education?id='+e
				})
			},
			work(){
				uni.navigateTo({
					url:'./work'
				})
			},
			education(){
				uni.navigateTo({
					url:'./education'
				})
			},
			portrait(){
				uni.navigateTo({
					url:'./portrait'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box{
		border-radius: 15rpx;
		margin-bottom: 20rpx;
		background-color: #FFFFFF;
	}
	.topBox{
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 30rpx;
		box-sizing: border-box;
		border-bottom: 2rpx solid rgba($color: #bbbbbb, $alpha: .5);
		color: #3291F8;
		.zuo{
			 display: flex;
			 font-size: 36rpx;
			 align-items: center;
		}
		.you{
			font-size: 30rpx;
		}
	}
	.portraitt{
		height: 300rpx;
		display: flex;
		align-items: center;
		box-sizing: border-box;
	}
	.portrait{
		box-sizing: border-box;
		padding: 30rpx 30rpx 30rpx 10rpx;
	}
	.jy{
		display: flex;
		align-items: center;
		justify-content: space-between;
		.zuo{
			width: 100%;
			.zzi{
				color: #101010;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 28rpx;
				margin-left: 15rpx;
				padding: 0 0 20rpx 30rpx;
				border-left: 4rpx solid #7AB8FB;
				.zi{
					margin-bottom: 10rpx;
				}
				.hui{
					color: #b3b3b3;
				}
				.da{
					width: 40rpx;
					height: 40rpx;
				}
			}
		}
	}
	.gz{
		.zuo{
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;
			text{
				color: #101010;
				display: block;
				font-size: 28rpx;
				&:last-child{
					color: #b3b3b3;
					margin-top: 15rpx;
				}					
			}
		}
	}
	.pj{
		padding: 30rpx;
		text{
			color: #101010;
			font-size: 28rpx;
		}
	}
	.shz{
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		padding: 24rpx 20rpx 24rpx 30rpx;
		.bookshelf-content{
			white-space: nowrap; // 滚动必须加的属性
		}
		image{
			// width: 151rpx;
			height: 158rpx;
			margin: 0 10rpx 4rpx 0;
		}
	}
</style>
